<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8" />
    <title>信息页</title>
    <script src="script/jquery.min.js"></script>
</head>
<style type="text/css">
    .clearfix:after {
        content:".";
        display:block;
        height:0;
        visibility:hidden;
        clear:both; }
    .clearfix {
        zoom:1;
    }
    .tchuang{
        width: 620px;
        height: 400px;
        background: url(images/tchuang.jpg) no-repeat;
        position: absolute;
        left: 50%;
        margin-left: -310px;
        top: 50%;
        margin-top: -200px;
    }
    .tchuang .m-box {
        width: 300px;
        height: 190px;
        position: absolute;
        left: 50%;
        bottom: 20px;
        margin-left: -150px;
    }
    .tchuang .tc-close {
        width: 34px;
        height: 34px;
        background: none;
        border: 0;
        color: #333;
        position: absolute;
        top: 2px;
        right: 2px;
        cursor: pointer;
    }
    .tchuang .tc-tel {
        width: 280px;
        height: 40px;
        background: #fff;
        border: 0;
        padding: 0 10px;
        font-size: 18px;
        line-height: 40px;
        color: #333;
        margin-bottom: 10px;
    }
    .tchuang .m-box .pic-box {
        margin-bottom: 10px;
    }
    .tchuang .m-box .pic-box #pic-code {
        width: 140px;
        height: 40px;
        line-height: 40px;
        float: left;
        margin-right: 20px;
        border: none;
        background: #fff;
        padding: 0 10px;
        font-size: 18px;
        color: #333;
        outline: none;
    }
    .tchuang .m-box .pic-box #btn-pic {
        width: 100px;
        height: 38px;
        float: left;
        font-weight: bold;
        font-size: 24px;
        color: #fff;
        line-height: 80px;
        border: 1px solid #ccc;
        overflow: hidden;
    }
    .tchuang .m-box .pic-box #btn-pic img {
        width: 100%;
    }
    .tchuang #id_code {
        width: 130px;
        border: none;
        height: 40px;
        line-height: 40px;
        color: #333;
        margin-bottom: 10px;
        float: left;
        margin-right: 10px;
        font-size: 18px;
        padding: 0 10px;
    }
    .tchuang #btn-code {
        width: 110px;
        height: 40px;
        float: left;
        line-height: 40px;
        font-size: 14px;
        color: #994e4d;
        border: none;
        cursor: pointer;
        background: #fdf9f9;
    }
    .tchuang .tc-btn {
        width: 300px;
        height: 40px;
        border: 0;
        font-size: 24px;
        line-height: 40px;
        background: url(images/sqkt.gif) no-repeat;
        color: #333;
        cursor: pointer;
    }
    .tchuang .tc-close {
        width: 34px;
        height: 34px;
        background: none;
        border: 0;
        color: #333;
        position: absolute;
        top: 2px;
        right: 2px;
        cursor: pointer;
    }
    .tc-suc {
        width: 400px;
        height: 250px;
        position: absolute;
        left: 50%;
        margin-left: -200px;
        top: 50%;
        margin-top: -125px;
        background: #fff;
        display: none;
    }
    .tc-suc h2 {
        margin: 0;
        font-size: 26px;
        text-align: center;
        line-height: 50px;
        position: relative;
        background: #da0503;
    }
    .tc-suc .suc-art {
        padding: 20px;
        font-size: 18px;
        color: #484848;
        font-size: 18px;
    }
    .tc-suc .suc-art span {
        color: #da0503;
        font-weight: bold;
    }
    .tc-suc .suc-btn {
        width: 150px;
        height: 50px;
        background: #da0503;
        display: block;
        margin: 0 auto;
        border: none;
        font-size: 30px;
        font-weight: bold;
        color: #fff;
        line-height: 50px;
        margin-top: 30px;
    }
    .dark {
        position: absolute;
        left: 0;
        top: 0;
        background: #000;
        filter: Alpha(opacity=60);
        opacity: 0.7;
        height: 100%;
        width: 100%;
    }
    .tc-suc h2 i{
        width: 34px;
        height: 34px;
        position: absolute;
        top: 2px;
        right: 2px;
        background: url(images/suc-c_03.png) no-repeat;
    }
</style>
<body>
    <div class="tchuang">
        <div class="m-box">
            <input type="text" class="tc-tel" placeholder="请输入您的手机号码">
            <div class="pic-box clearfix">
                <input type="text" placeholder="输入验证码" id="pic-code">
                <div id="btn-pic"><img src="" alt=""></div>
            </div>
            <div class="tc-yzm clearfix">
                <input type="text" placeholder="验证码" id="id_code">
                <input type="button" id="btn-code" value="免费获取验证码" onclick="seam(this)">
            </div>
            <button class="tc-btn" onclick="phone()"></button>
        </div>
    </div>
    <div class="tc-suc">
        <h2>温馨提示<i></i></h2>
        <div class="suc-art">
            亲，你申请的功能属于<span>国诚投资VIP功能</span>，国诚客服团队将在24小时内联系您！请注意0755-36100788的来电接听。
            <button class="suc-btn">确定</button>
        </div>
    </div>
</body>
</html>
<script type="text/javascript">
    $(function(){
        // 弹窗
        $(document).on('click','.tc-close',function(){
            window.parent.document.getElementById("popup").style.display="none";
            // $('.tc_dan').fadeOut(300);
        });
        $(document).on('click','.tc-suc h2 i',function(){
            // $('.popup').fadeOut(300);
            window.parent.document.getElementById("popup").style.display="none";
        });
        $(document).on('click','.suc-btn',function(){
            // $('.popup').fadeOut(300);
            window.parent.document.getElementById("popup").style.display="none";
        });
    })
    // 验证码60S倒计时
    function seam(_this){
        var tel = $('.tchuang .tc-tel');
        var mobile = tel.val().match(/^1[3|4|5|7|8][0-9]\d{8}$/);
        if(!mobile){
            alert('手机号码不正确，请重新输入！');
            tel.val('');
            tel.focus();
            return false;
        }else{
            time(_this);
        }
    }
    var times = 60;
    function time(o){
        if(times == 0){
            o.removeAttribute("disabled");       
            o.value="免费获取验证码";
            times = 60;
            $('.popup .tchuang #btn-code').css({'color':'#994e4d'});
        }else{
            o.setAttribute("disabled",true);
            o.value="重新发送(" + times + ")";
            times--;
            setTimeout(function() {
                time(o)
            },
            1000)
            $('.popup .tchuang #btn-code').css({'color':'#ccc'});
        }
    }
    function phone(){
        var tel = $('.tchuang .tc-tel');
        var pic_code = $('.tchuang .m-box .pic-box #pic-code').val().length;
        var tel_code = $('.tchuang #id_code').val();
        var mobile = tel.val().match(/^1[3|4|5|7|8][0-9]\d{8}$/);
        if(!mobile){
            alert('手机号码不正确，请重新输入！');
            tel.val('');
            tel.focus();
            return false;
        }else if(pic_code == 0){
            alert("请输入图形验证码!");
            $('.popup .tchuang .m-box .pic-box #pic-code').focus();
            return false;
        }else if(pic_code != 4){
            alert("图形验证码不准确!请重新输入");
            $('.popup .tchuang .m-box .pic-box #pic-code').focus();
            return false;
        }else if(tel_code == ""){
            alert("请输入手机验证码!");
            return false;
        }else{
            web_join(tel.val());
        }
    }
    function web_join(tel){
    var data = {
        position: 1,
        a_id: 128,
        phone: tel,
        login_id: '',
        data: {
            username: '',
            phone: tel,
            login_id: '',
            stock: '',
            type:''
        },
        success_msg: '',
        error_msg: ''
    };
    $.ajax({
        url: 'http://actapi.gdgccj.com/index/activity/web_join?'+ + encodeURI(location.search.substring(1)),
        type: 'POST',
        data: data,
        cache: false,
        dataType: "jsonp",
        success: function(data) {
            // $('.tchuang').fadeOut(300);
            $('.tc-suc').fadeIn(300);
        }
    });

}
</script>